<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
    <title>文本域输入内容按钮可用</title>
    <script src="JS/react.js"></script>
    <script src="JS/react-dom.js"></script>
	<script src="JS/browser.min.js"></script>
  </head>
  <body>
    <div id="example"></div>  
    <script type="text/babel">
		// 一个文本域和提交按钮
  		var TextBox = React.createClass({
    		// 初始化状态
    		getInitialState:function(){
      			return {
        			text:""
      			};
    		},
    		render: function() {
      			return (
        			<div>
          				<textarea onChange={this.handleChange}></textarea>
          				<br/>
          				<button disabled={this.state.text.length == 0}>测试</button>
        			</div>
      			);
    		},
    		// 监听文本域内容变化，更新text
    		handleChange: function(event) {
      			this.setState({text:event.target.value});//自动重新渲染组件
    		}
  		});
		ReactDOM.render(
			<TextBox />,
			document.getElementById('example')
		);
    </script>
  </body>
</html>
